<?php require_once(dirname(__FILE__).'/inc/config.inc.php');
if ( $_SESSION['adminlevel']>1  &&   $_SESSION['is_wage']=='0' && $_SESSION['check_wage']=='0'   ){
	echo "你没有权限";
	exit();
}
require_once "function.php";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<title>修改工资信息</title>
	<link href="templates/style/admin.css" rel="stylesheet" type="text/css" />
	<script type="text/javascript" src="templates/js/jquery.min.js"></script>
	<script type="text/javascript" src="layer/layer.js"></script>
	<!-- 最新版本的 Bootstrap 核心 CSS 文件 -->
	<link rel="stylesheet" href="ui/css/bootstrap.min.css">
	<link rel="stylesheet" href="ui/css/bootstrap-theme.min.css" >
	<link rel="stylesheet" href="templates/js/zoomify.min.css">
	<script language="javascript" type="text/javascript" src="DatePicker/WdatePicker.js"></script>
	<style type="text/css">
		.main_box{width: 900px;margin:0 auto; height: auto; overflow: hidden;}
		.main_box h1{ text-align: center; }
		.mb10{ margin-bottom: 10px; }
		.w58{ width: 50px !important }
		.tx-l{ text-align: left; }
		.w650{ width: 650px; }
		.f-b{ font-weight: bold; color: red; }
		.table{ margin:0 !important; }
	</style>
</head>
<body>
	<?php
	$sql="SELECT f.* ,u.truename as truename,u.zhiwu as zhiwuid,u.id as newuid,u.join_time  FROM `#@__wage` as f
	left join `#@__user`   as u on u.id=f.uid
	left join `#@__cascadedata` as z on z.datavalue=u.zhiwu WHERE f.`id`=$id";
	$row = $dosql->GetOne($sql);

	$uid=$row['uid'];

	$zhiwuname=cascadedata('zhiwu',$row['zhiwuid']);
	$uname=$row['truename'];
	$join_time=date("Y-m-d",$row['join_time']);
    $creat_time=$row['creat_time'];
    $join_year=floor(($creat_time-$row['join_time']-30*24*3600)/(365*24*60*60));
	//$join_year=floor((time()-$row['join_time'])/(365*24*60*60));
	$gongligongzi=$row['gongling_wage'];
	//基础补助
	$jichugongzi=$row['zhiwu_wage']+$row['dixin_wage']+$row['dianhua_wage']+$row['jiadang_wage']+$row['weisheng_wage']+$gongligongzi+$row['tuandui_wage']+$row['quanqin_wage'];
	//其他补助
	$qitabuzhu=$row['yewu_wage']+$row['ticheng_wage']+$row['zhusu_wage']+$row['bukuan_wage'];
	//总计工资
	$zongji_wage=$jichugongzi+$qitabuzhu+$row['yiliao_wage']+$row['yanglao_wage']+$row['gongshang_wage'];

	//实发工资
	$shiji_wage=$zongji_wage-$row['f_kaoqin_wage']-$row['f_yanglao_wage']-$row['f_yiliao_wage']-$row['f_gongjijin_wage']-$row['f_qita_wage'];

		//获取审核状态
	switch($row['checkinfo'])
	{
		case '1':
		$checkinfo = '已审';
		break;
		case '0':
		$checkinfo = '未审';
		break;
		default:
		$checkinfo = '没有获取到参数';
	}


	
	?>
	
	<div class="main_box" >
		<h1><?php echo $uname;?>-<?php echo date("Y-m",$row['wage_month'])?> 月份工资</h1>
		<table  class="table mb10" >
			<tr><td width="80%"><span class="red">[<?php echo $checkinfo;?>] </span>工资表制作日期: 
				<?php echo date("Y-m-d H:i:s",$row['creat_time'])?></td>
			</tr>
		</table>


		<div class="panel panel-primary">
			<div class="panel-heading">
				<h3 class="panel-title">基础工资</h3>
			</div>
			<div class="panel-body">
				<table class="table table-bordered">
					<tr>
						<td width="10%">姓名:</td><td class="red" width="15%"><?php echo $uname;?></td>
						<td width="10%">职务：</td><td class="red" width="15%"><?php echo $zhiwuname;?></td>
						<td width="15%">入职时间:</td><td class="red" width="10%"><?php echo $join_time;?></td>
						<td width="12.5%">工龄：</td><td class="red" width="12.5%"><?php echo $join_year;?> 年</td>
					</tr>
					<tr>
						<td width="10%">职务工资:</td><td class="red" width="15%"><?php echo $row['zhiwu_wage'];?></td>
						<td width="10%">底薪：</td><td class="red" width="15%"><?php echo $row['dixin_wage'];?></td>
						<td width="15%">电话费:</td><td class="red" width="10%"><?php echo $row['dianhua_wage'];?></td>
						<td width="12.5%">工资加档：</td><td class="red" width="12.5%"><?php echo $row['jiadang_wage'];?></td>
					</tr>
					<tr>
						<td width="10%">卫生奖:</td><td class="red" width="15%"><?php echo $row['weisheng_wage'];?></td>
						<td width="10%">工龄工资：</td><td class="red" width="15%"><?php echo $row['gongling_wage'];?>[实发]</td>
						<td width="15%">团队协作奖:</td><td class="red" width="10%"><?php echo $row['tuandui_wage'];?></td>
						<td width="12.5%">全勤奖：</td><td class="red" width="12.5%"><?php echo $row['quanqin_wage'];?></td>
					</tr>
					<tr>
						<td width="10%"  class="f-b">基础工资:</td><td class="red" colspan="7" width="90%"><?php echo $jichugongzi;?></td>

					</tr>
				</table>
			</div>
		</div>
		<div class="panel panel-danger">
			<div class="panel-heading">
				<h3 class="panel-title">其他补款</h3>
			</div>
			<div class="panel-body">
				<table class="table table-bordered">
					<tr>
						<td width="10%">派单补贴:</td><td class="red" width="15%"><?php echo $row['yewu_wage'];?></td>
						<td width="10%">业务提成：</td><td class="red" width="15%"><?php echo $row['ticheng_wage'];?></td>
						<td width="10%">住宿补贴:</td><td class="red" width="15%"><?php echo $row['zhusu_wage'];?></td>
						<td width="12.5%">其他补助：</td><td class="red" width="12.5%"><?php echo $row['bukuan_wage'];?></td>
					</tr>
					<tr>
						<td colspan="8" >其他补助说明:
							<?php echo trim($row['bukuan_summary']);?>
						</td>

					</tr>
					<tr>
						<td width="10%" class="f-b">其他补款:</td><td class="red" colspan="7" width="90%"><?php echo $qitabuzhu;?></td>

					</tr>
				</table>
			</div>
		</div>
		<div class="panel panel-success">
			<div class="panel-heading">
				<h3 class="panel-title">保险缴纳</h3>
			</div>
			<div class="panel-body">
				<table class="table table-bordered">
					<tr>
						<td width="18%">养老保险:</td><td class="red" width="18%"><?php echo $row['yanglao_wage'];?></td>
						<td width="18%">医疗保险：</td><td class="red" width="18%"><?php echo $row['yiliao_wage'];?></td>
						<td width="18%">工伤保险:</td><td class="red" colspan="3" ><?php echo $row['gongshang_wage'];?></td>

					</tr>
					<tr>
						<td width="18%" class="f-b">当月应发工资:</td><td class="red" colspan="7" width="89%"><?php echo $zongji_wage;?></td>

					</tr>
				</table>
			</div>
		</div>

		<div class="panel panel-info">
			<div class="panel-heading">
				<h3 class="panel-title">实发工资</h3>
			</div>
			<div class="panel-body">
				<table class="table table-bordered">
					<tr>
						<td width="15%">考勤扣款:</td><td class="red" width="10%"><?php echo $row['f_kaoqin_wage'];?></td>
						<td width="15%">养老保险扣款：</td><td class="red" width="10%"><?php echo $row['f_yanglao_wage'];?></td>
						<td width="15%">医疗保险扣款：</td><td class="red" width="10%" ><?php echo $row['f_yiliao_wage'];?></td>
						<td width="15%">公积金扣款：</td><td class="red" width="10%" ><?php echo $row['f_gongjijin_wage'];?></td>
					</tr>
					<tr>
						<td width="15%">其他扣款:</td><td class="red" width="10%"><?php echo $row['f_qita_wage'];?></td>
						<td width="15%">其他扣款说明</td><td class="red" colspan="5" width="60%"><?php echo $row['f_qita_summary'];?></td>

					</tr>
					<tr>
						<td width="15%" class="f-b">当月实发工资:</td><td class="red" colspan="7" width="75%"><?php echo $shiji_wage;?></td>

					</tr>
				</table>
			</div>
		</div>
	</div>
	
	
</body>
</html>